jQuery(document).ready(function()
    {   
        jQuery('#name').parent().append("<br/><span id='availability_status'></span>");  
        jQuery('#name').blur(function() 

        {      
            
            var name    = jQuery("#name").val();
         
            if(name.length > 3)//if the lenght greater than 3 characters
            {
                $("#availability_status").html('<img src="custom/themes/default/images/loadingyahoo.gif" align="absmiddle">&nbsp;Checking availability...');
                jQuery.ajax({  //Make the Ajax Request
                    type: "POST",  
/*                    url: "index.php?module="+module+"&entryPoint=AjaxCheckDuplicate",*/
                    url: "AjaxCheckDuplicate.php?module="+module,
                    data: {
                        module: module,
                        name : name,
                        //a = a
                        
                    } ,
                    
                    success: function(server_response){  

                        jQuery("#availability_status").ajaxComplete(function(event, request){ 

                            if(server_response == '0')
                            { 
                                 jQuery("#availability_status").html('<img src="custom/themes/default/images/available.png" align="absmiddle"> <font color="Green"> Available </font>  ');

                            }  

                            else {
                                result = server_response;//
                                 jQuery("#availability_status").html(result);
                            }

                        });
                    } 

                }); 

            }
            else
            {

                 //jQuery('#name').parent().append('<br/><font color="#cc0000">Full Name too short</font>');
                 jQuery('#availability_status').html('<font color="#cc0000">Full Name too short</font>');
				 
                return;

            }



            return false;
        });
        
       

    });
    